<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script src="script/listBook.js"></script>

<title>Search Active Trainee</title>
</head>
<body>
	<center>
		<h1>List All Book</h1>
		<hr>

		<div id="result">
			<html:form action="/deleteBook">

				<html:submit property="function" value="Delete"
					onclick="return myFunction()" styleClass="activeBtn"></html:submit>

				<logic:notEmpty name="errorMessage">
					<hr>
					<p class="colorRed noneWeight">
						<bean:write name="errorMessage" />
					</p>
				</logic:notEmpty>

				<logic:notEmpty name="success">
					<hr>
					<p class="colorGreen noneWeight">
						<bean:write name="success" />
					</p>
				</logic:notEmpty>
				<table class="normalTable" id="listBookTable">
					<tr>
						<th><input type="checkbox" id="masterCheckbox" />
						<th>Tên sách</th>
						<th>Tác giả</th>
						<th>Thư mục</th>
						<th>Nhà xuất bản</th>
						<th>Giá bán</th>
						<th>Số lượng</th>
						<th>Edit</th>
					</tr>
					<logic:notEmpty name="bookList">
						<logic:iterate id="book" name="bookList">
							<tr>
								<td><input type="checkbox" class="case"
									name="selectedBook" value="${book.bookID }" /></td>
								<td><bean:write name="book" property="bookName" /></td>
								<td><bean:write name="book" property="author" /></td>
								<td><bean:write name="book" property="categoryName" /></td>
								<td><bean:write name="book" property="publisher" /></td>
								<td><bean:write name="book" property="price" /></td>
								<td><bean:write name="book" property="unitInStock" /></td>
								<td><html:link paramName="book"
										paramProperty="bookID" paramId="chosenBookID"
										action="/goEditBook?linkTo=goListBook.fu">Edit</html:link></td>
							</tr>
						</logic:iterate>
					</logic:notEmpty>
					<logic:empty name="bookList">
						<tr>
							<td colspan="7" align="center">No record found. Please try
								again!</td>
						</tr>
					</logic:empty>
				</table>
			</html:form>
			<logic:notEmpty name="bookList">
				<br>
				<input type="hidden" id="currentPage" value="1">

				<logic:notEqual value="1" name="currentPage">
					<a href="#" id="Previous">Previous</a>
				</logic:notEqual>
				<b><bean:write name='currentPage' /></b>
				<logic:notEqual value="1" name="numberOfPage">
					<a href="#" id="Next">Next</a>
					<a href="#" id="Last">Last</a>
				</logic:notEqual>
				<br>
				<br> 
				
				Page <input type="text" style="width: 25px"
					value="<bean:write name='currentPage' />" id="txtPage"> /
				
				<bean:write name='numberOfPage' />

				<input type="button" value="GO" id="btnGo">
			</logic:notEmpty>
		</div>
	</center>
</body>
</html>